import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _class, _class2;

/**
 * notice - 公告管理
 * @date: 2018-9-20

 */
import React from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { Button, Col, DatePicker, Form, Icon, Input, Popconfirm, Row, Select, Table, Tabs } from 'antd';
import { Bind } from 'lodash-decorators';
import moment from 'moment';
import { Content, Header } from 'components/Page';
import Checkbox from 'components/Checkbox';
import cacheComponent from 'components/CacheComponent';
import { Button as ButtonPermission } from 'components/Permission';
import { dateTimeRender, operatorRender } from 'utils/renderer';
import notification from 'utils/notification';
import formatterCollections from 'utils/intl/formatterCollections';
import intl from 'utils/intl';
import { getCurrentOrganizationId, getDateTimeFormat, isTenantRoleLevel, tableScrollWidth } from 'utils/utils';
import { DEFAULT_DATETIME_FORMAT, // DEFAULT_DATE_FORMAT,
DEFAULT_TIME_FORMAT, FORM_COL_4_LAYOUT, SEARCH_FORM_ITEM_LAYOUT, SEARCH_FORM_ROW_LAYOUT } from 'utils/constants';
import SystemNoticePublishDrawer from "./SystemNoticePublishDrawer";
var FormItem = Form.Item;
var TabPane = Tabs.TabPane;
var Option = Select.Option;
var Notice = (_dec = connect(function (_ref) {
  var loading = _ref.loading,
      cmsgNotice = _ref.cmsgNotice;
  return {
    cmsgNotice: cmsgNotice,
    organizationId: getCurrentOrganizationId(),
    isTenantRole: isTenantRoleLevel(),
    publicLoading: loading.effects['cmsgNotice/publicNotice'],
    fetchNoticeLoading: loading.effects['cmsgNotice/fetchNotice'],
    removeDraftReceiveLoading: loading.effects['cmsgNotice/removeDraftReceive'],
    querySystemHistoryLoading: loading.effects['cmsgNotice/querySystemHistory'],
    queryReceiverLoading: loading.effects['cmsgNotice/queryReceiver'],
    createReceiverLoading: loading.effects['cmsgNotice/createReceiver'],
    publishSystemNoticeLoading: loading.effects['cmsgNotice/publishSystemNotice']
  };
}), _dec2 = Form.create({
  fieldNameProp: null
}), _dec3 = formatterCollections({
  code: ['cmsg.notice', 'entity.lang', 'cmsg.common']
}), _dec4 = cacheComponent({
  cacheKey: '/cmsg/notices/list'
}), _dec5 = Bind(), _dec6 = Bind(), _dec7 = Bind(), _dec8 = Bind(), _dec9 = Bind(), _dec10 = Bind(), _dec11 = Bind(), _dec12 = Bind(), _dec13 = Bind(), _dec14 = Bind(), _dec15 = Bind(), _dec16 = Bind(), _dec17 = Bind(), _dec18 = Bind(), _dec19 = Bind(), _dec20 = Bind(), _dec21 = Bind(), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = (_class2 = /*#__PURE__*/function (_React$PureComponent) {
  _inherits(Notice, _React$PureComponent);

  var _super = _createSuper(Notice);

  function Notice(props) {
    var _this;

    _classCallCheck(this, Notice);

    _this = _super.call(this, props);
    _this.state = {
      isExpendSearch: false,
      actionNoticeId: ''
    };
    return _this;
  }

  _createClass(Notice, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'cmsgNotice/init'
      });
      this.fetchNotice({
        containsDeletedDataFlag: 1
      });
    }
    /**
     * @function fetchEmail - 获取公告列表数据
     * @param {object} params - 查询参数
     * @param {number} params.page - 页码
     * @param {number} params.size - 页数
     */

  }, {
    key: "fetchNotice",
    value: function fetchNotice() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _this$props = this.props,
          dispatch = _this$props.dispatch,
          form = _this$props.form,
          organizationId = _this$props.organizationId,
          _this$props$cmsgNotic = _this$props.cmsgNotice.pagination,
          pagination = _this$props$cmsgNotic === void 0 ? {} : _this$props$cmsgNotic; // 格式化时间

      var _form$getFieldsValue = form.getFieldsValue(),
          fromDate = _form$getFieldsValue.fromDate,
          toDate = _form$getFieldsValue.toDate,
          publishedDateFrom = _form$getFieldsValue.publishedDateFrom,
          publishedDateTo = _form$getFieldsValue.publishedDateTo;

      var dateParams = {
        fromDate: fromDate && moment(fromDate).format(DEFAULT_DATETIME_FORMAT),
        toDate: toDate && moment(toDate).format(DEFAULT_DATETIME_FORMAT),
        publishedDateFrom: publishedDateFrom && moment(publishedDateFrom).format(DEFAULT_DATETIME_FORMAT),
        publishedDateTo: publishedDateTo && moment(publishedDateTo).format(DEFAULT_DATETIME_FORMAT)
      };
      dispatch({
        type: 'cmsgNotice/fetchNotice',
        payload: _objectSpread(_objectSpread(_objectSpread({
          organizationId: organizationId,
          page: pagination
        }, form.getFieldsValue()), dateParams), params)
      });
    }
    /**
     * @function handleCreate - 新建
     */

  }, {
    key: "handleCreate",
    value: function handleCreate() {
      var history = this.props.history;
      history.push('/cmsg/notices/detail/create');
    }
    /**
     * @function handlePagination - 分页操作
     */

  }, {
    key: "handlePagination",
    value: function handlePagination(pagination) {
      this.fetchNotice({
        page: pagination
      });
    }
    /**
     * @function handleExpendSearch - 显示高级查询条件
     * @param {boolean} flag - 显示高级查询标识
     */

  }, {
    key: "handleExpendSearch",
    value: function handleExpendSearch() {
      var isExpendSearch = this.state.isExpendSearch;
      this.setState({
        isExpendSearch: !isExpendSearch
      });
    }
    /**
     * 重置查询表单
     */

  }, {
    key: "handleResetSearch",
    value: function handleResetSearch() {
      var form = this.props.form;

      var _ref2 = form.getFieldsValue() || {},
          _ref2$receiverTypeCod = _ref2.receiverTypeCode,
          receiverTypeCode = _ref2$receiverTypeCod === void 0 ? '' : _ref2$receiverTypeCod;

      form.resetFields();
      form.setFieldsValue({
        receiverTypeCode: receiverTypeCode
      });
    }
    /**
     * @function handleSearch - 搜索公告
     */

  }, {
    key: "handleSearch",
    value: function handleSearch() {
      this.fetchNotice({
        page: {}
      });
    }
    /**
     * @function handleNoticeTypeChange - 切换类别
     * @param {*} e - 事件对象
     */

  }, {
    key: "handleNoticeTypeChange",
    value: function handleNoticeTypeChange(key) {
      this.fetchNotice({
        receiverTypeCode: key
      });
    }
    /**
     * @function handlePublicNotice - 发布公告信息
     * @param {string} organizationId - 租户ID
     * @param {object} record - 公告信息行数据
     * @param {string} record.noticeId - 公告信息ID
     */

  }, {
    key: "handlePublicNotice",
    value: function handlePublicNotice(record) {
      var _this2 = this;

      var _this$props2 = this.props,
          dispatch = _this$props2.dispatch,
          organizationId = _this$props2.organizationId;
      this.setState({
        actionNoticeId: record.noticeId
      });

      if (record.receiverTypeCode === 'NOTIFY' || record.receiverTypeCode === 'ANNOUNCE') {
        dispatch({
          type: 'cmsgNotice/updateState',
          payload: {
            systemNoticePublishModalVisible: true,
            systemNoticePublishRecord: record
          }
        });
      } else {
        dispatch({
          type: 'cmsgNotice/publicNotice',
          payload: {
            organizationId: organizationId,
            noticeId: record.noticeId
          }
        }).then(function (res) {
          if (res) {
            notification.success();

            _this2.fetchNotice();
          }
        });
      }
    }
    /**
     * @function handleRevokeNotice - 撤销删除公告信息
     * @param {string} organizationId - 租户ID
     * @param {object} record - 公告信息行数据
     * @param {string} record.noticeId - 公告信息ID
     */

  }, {
    key: "handleRevokeNotice",
    value: function handleRevokeNotice(record) {
      var _this3 = this;

      var _this$props3 = this.props,
          dispatch = _this$props3.dispatch,
          organizationId = _this$props3.organizationId;
      dispatch({
        type: 'cmsgNotice/revokeNotice',
        payload: {
          organizationId: organizationId,
          noticeId: record.noticeId,
          record: record
        }
      }).then(function (res) {
        if (res) {
          notification.success();

          _this3.fetchNotice({
            containsDeletedDataFlag: 1
          });
        }
      });
    }
    /**
     * @function handleDeleteNotice - 删除公告信息
     * @param {string} organizationId - 租户ID
     * @param {object} record - 公告信息行数据
     * @param {string} record.noticeId - 公告信息ID
     */

  }, {
    key: "handleDeleteNotice",
    value: function handleDeleteNotice(record) {
      var _this4 = this;

      var _this$props4 = this.props,
          dispatch = _this$props4.dispatch,
          organizationId = _this$props4.organizationId;
      dispatch({
        type: 'cmsgNotice/deleteNotice',
        payload: _objectSpread({
          organizationId: organizationId
        }, record)
      }).then(function (res) {
        if (res) {
          notification.success();

          _this4.fetchNotice();
        }
      });
    }
    /**
     * @function renderFilterForm - 渲染筛选查询表单
     */

  }, {
    key: "renderFilterForm",
    value: function renderFilterForm() {
      var _this$props5 = this.props,
          form = _this$props5.form,
          _this$props5$cmsgNoti = _this$props5.cmsgNotice,
          _this$props5$cmsgNoti2 = _this$props5$cmsgNoti.noticeReceiverType,
          noticeReceiverType = _this$props5$cmsgNoti2 === void 0 ? [] : _this$props5$cmsgNoti2,
          _this$props5$cmsgNoti3 = _this$props5$cmsgNoti.noticeCategory,
          noticeCategory = _this$props5$cmsgNoti3 === void 0 ? [] : _this$props5$cmsgNoti3,
          _this$props5$cmsgNoti4 = _this$props5$cmsgNoti.noticeStatus,
          noticeStatus = _this$props5$cmsgNoti4 === void 0 ? [] : _this$props5$cmsgNoti4;
      var getFieldDecorator = form.getFieldDecorator;

      var _ref3 = form.getFieldsValue() || {},
          _ref3$receiverTypeCod = _ref3.receiverTypeCode,
          receiverTypeCode = _ref3$receiverTypeCod === void 0 ? '' : _ref3$receiverTypeCod;

      var isExpendSearch = this.state.isExpendSearch;
      return /*#__PURE__*/React.createElement(Form, {
        className: "more-fields-search-form"
      }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(FormItem, null, getFieldDecorator('receiverTypeCode', {
        initialValue: ''
      })( /*#__PURE__*/React.createElement(Tabs, {
        onChange: this.handleNoticeTypeChange,
        defaultActiveKey: "",
        activeKey: receiverTypeCode,
        animated: false
      }, /*#__PURE__*/React.createElement(TabPane, {
        key: "",
        tab: intl.get('cmsg.notice.model.notice.receiverTypeCode.All').d('全部公告')
      }), noticeReceiverType.map(function (item) {
        return /*#__PURE__*/React.createElement(TabPane, {
          tab: item.meaning,
          key: item.value
        });
      })))))), /*#__PURE__*/React.createElement(Row, SEARCH_FORM_ROW_LAYOUT, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Row, Object.assign({}, SEARCH_FORM_ROW_LAYOUT, {
        type: "flex",
        gutter: 12,
        align: "bottom"
      }), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.model.notice.title').d('公告标题')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('title')( /*#__PURE__*/React.createElement(Input, {
        style: {
          width: '100%'
        }
      })))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.model.notice.noticeCategoryCode').d('公告类别')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('noticeCategoryCode')( /*#__PURE__*/React.createElement(Select, {
        allowClear: true,
        style: {
          width: '100%'
        }
      }, noticeCategory.map(function (item) {
        return /*#__PURE__*/React.createElement(Option, {
          value: item.value,
          key: item.value
        }, item.meaning);
      }))))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.model.notice.statusCode').d('公告状态')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('statusCode')( /*#__PURE__*/React.createElement(Select, {
        allowClear: true,
        style: {
          width: '100%'
        }
      }, noticeStatus.map(function (item) {
        return /*#__PURE__*/React.createElement(Option, {
          value: item.value,
          key: item.value
        }, item.meaning);
      }))))), /*#__PURE__*/React.createElement(Col, Object.assign({}, FORM_COL_4_LAYOUT, {
        className: "search-btn-more"
      }), /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(Button, {
        onClick: this.handleExpendSearch
      }, isExpendSearch ? intl.get('cpaas.common.button.collected').d('收起查询') : intl.get('cpaas.common.button.viewMore').d('更多查询')), /*#__PURE__*/React.createElement(Button, {
        onClick: this.handleResetSearch
      }, intl.get('cpaas.common.button.reset').d('重置')), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        htmlType: "submit",
        onClick: this.handleSearch
      }, intl.get('cpaas.common.button.search').d('查询'))))), /*#__PURE__*/React.createElement(Row, Object.assign({}, SEARCH_FORM_ROW_LAYOUT, {
        style: {
          display: isExpendSearch ? '' : 'none'
        },
        type: "flex",
        gutter: 12,
        align: "bottom"
      }), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.model.notice.noticeContent').d('公告内容')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('noticeBody')( /*#__PURE__*/React.createElement(Input, {
        style: {
          width: '100%'
        }
      })))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.view.notice.creationFrom').d('创建时间从')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('fromDate')( /*#__PURE__*/React.createElement(DatePicker, {
        style: {
          width: '100%'
        },
        placeholder: "",
        format: getDateTimeFormat(),
        showTime: {
          format: DEFAULT_TIME_FORMAT
        },
        disabledDate: function disabledDate(currentDate) {
          return form.getFieldValue('toDate') && moment(form.getFieldValue('toDate')).isBefore(currentDate, 'day');
        }
      })))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.view.notice.creationTo').d('创建时间至')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('toDate')( /*#__PURE__*/React.createElement(DatePicker, {
        style: {
          width: '100%'
        },
        placeholder: "",
        format: getDateTimeFormat(),
        showTime: {
          format: DEFAULT_TIME_FORMAT
        },
        disabledDate: function disabledDate(currentDate) {
          return form.getFieldValue('fromDate') && moment(form.getFieldValue('fromDate')).isAfter(currentDate, 'day');
        }
      }))))))), /*#__PURE__*/React.createElement(Row, Object.assign({}, SEARCH_FORM_ROW_LAYOUT, {
        style: {
          display: isExpendSearch ? '' : 'none'
        },
        type: "flex",
        gutter: 12,
        align: "bottom"
      }), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cpaas.common.date.release.from').d('发布日期从')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('publishedDateFrom')( /*#__PURE__*/React.createElement(DatePicker, {
        style: {
          width: '100%'
        },
        placeholder: "",
        format: getDateTimeFormat(),
        disabledDate: function disabledDate(currentDate) {
          return form.getFieldValue('publishedDateTo') && moment(form.getFieldValue('publishedDateTo')).isBefore(currentDate, 'day');
        }
      })))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cpaas.common.date.release.to').d('发布日期至')
      }, SEARCH_FORM_ITEM_LAYOUT), getFieldDecorator('publishedDateTo')( /*#__PURE__*/React.createElement(DatePicker, {
        style: {
          width: '100%'
        },
        placeholder: "",
        format: getDateTimeFormat(),
        disabledDate: function disabledDate(currentDate) {
          return form.getFieldValue('publishedDateFrom') && moment(form.getFieldValue('publishedDateFrom')).isAfter(currentDate, 'day');
        }
      }))))), /*#__PURE__*/React.createElement(Row, SEARCH_FORM_ROW_LAYOUT, /*#__PURE__*/React.createElement(Col, Object.assign({
        offset: 20
      }, FORM_COL_4_LAYOUT), /*#__PURE__*/React.createElement(FormItem, Object.assign({
        label: intl.get('cmsg.notice.model.notice.containsDeletedDataFlag').d('显示已删除')
      }, SEARCH_FORM_ITEM_LAYOUT), form.getFieldDecorator('containsDeletedDataFlag', {
        initialValue: 1
      })( /*#__PURE__*/React.createElement(Checkbox, null))))));
    } // SystemNoticePublicModal

    /**
     *
     */

  }, {
    key: "handleSystemNoticeModalOk",
    value: function handleSystemNoticeModalOk() {
      this.closeSystemNoticeModal();
    }
    /**
     *
     */

  }, {
    key: "handleSystemNoticeModalCancel",
    value: function handleSystemNoticeModalCancel() {
      this.closeSystemNoticeModal();
    }
    /**
     * 关闭 System 发布 模态框, 会重置 所有信息
     */

  }, {
    key: "closeSystemNoticeModal",
    value: function closeSystemNoticeModal() {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'cmsgNotice/updateState',
        payload: {
          systemNoticePublishModalVisible: false,
          // 发送系统消息公告
          systemNoticePublishRecord: {},
          // 发送当前系统消息公告的记录
          systemNoticeHistoryDataSource: [],
          // 历史信息 数据
          systemNoticeHistoryPagination: false,
          // 历史信息 分页
          systemNoticeHistorySelectedRows: [],
          // 历史信息 选中数据
          systemNoticeHistorySelectedRowKeys: [],
          // 历史信息 选中数据key
          systemNoticeReceiveDataSource: [],
          // 接收信息 数据
          systemNoticeReceivePagination: false // 接收信息 分页

        }
      });
    } // SystemNoticePublishModal 相关的 model 调用

  }, {
    key: "removeDraftReceive",
    value: function removeDraftReceive(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'cmsgNotice/removeDraftReceive',
        payload: payload
      });
    }
  }, {
    key: "querySystemHistory",
    value: function querySystemHistory(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'cmsgNotice/querySystemHistory',
        payload: payload
      });
    }
  }, {
    key: "queryReceiver",
    value: function queryReceiver(payload) {
      var _this$props6 = this.props,
          dispatch = _this$props6.dispatch,
          _this$props6$cmsgNoti = _this$props6.cmsgNotice.systemNoticeHistorySelectedRowKeys,
          systemNoticeHistorySelectedRowKeys = _this$props6$cmsgNoti === void 0 ? [] : _this$props6$cmsgNoti;
      return dispatch({
        type: 'cmsgNotice/queryReceiver',
        payload: _objectSpread(_objectSpread({}, payload), {}, {
          prevSystemNoticeHistorySelectedRowKeys: systemNoticeHistorySelectedRowKeys
        })
      });
    }
  }, {
    key: "createReceiver",
    value: function createReceiver(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'cmsgNotice/createReceiver',
        payload: payload
      });
    }
  }, {
    key: "publishSystemNotice",
    value: function publishSystemNotice(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'cmsgNotice/publishSystemNotice',
        payload: payload
      });
    }
  }, {
    key: "render",
    value: function render() {
      var _this5 = this;

      var _this$props7 = this.props,
          fetchNoticeLoading = _this$props7.fetchNoticeLoading,
          publicLoading = _this$props7.publicLoading,
          path = _this$props7.match.path,
          _this$props7$cmsgNoti = _this$props7.cmsgNotice,
          _this$props7$cmsgNoti2 = _this$props7$cmsgNoti.noticeList,
          noticeList = _this$props7$cmsgNoti2 === void 0 ? [] : _this$props7$cmsgNoti2,
          _this$props7$cmsgNoti3 = _this$props7$cmsgNoti.pagination,
          pagination = _this$props7$cmsgNoti3 === void 0 ? {} : _this$props7$cmsgNoti3,
          _this$props7$cmsgNoti4 = _this$props7$cmsgNoti.systemNoticePublishModalVisible,
          systemNoticePublishModalVisible = _this$props7$cmsgNoti4 === void 0 ? false : _this$props7$cmsgNoti4,
          systemNoticePublishRecord = _this$props7$cmsgNoti.systemNoticePublishRecord,
          systemNoticeHistoryDataSource = _this$props7$cmsgNoti.systemNoticeHistoryDataSource,
          systemNoticeHistoryPagination = _this$props7$cmsgNoti.systemNoticeHistoryPagination,
          systemNoticeHistorySelectedRows = _this$props7$cmsgNoti.systemNoticeHistorySelectedRows,
          systemNoticeHistorySelectedRowKeys = _this$props7$cmsgNoti.systemNoticeHistorySelectedRowKeys,
          systemNoticeReceiveDataSource = _this$props7$cmsgNoti.systemNoticeReceiveDataSource,
          systemNoticeReceivePagination = _this$props7$cmsgNoti.systemNoticeReceivePagination,
          _this$props7$cmsgNoti5 = _this$props7$cmsgNoti.receiverRecordType,
          receiverRecordType = _this$props7$cmsgNoti5 === void 0 ? [] : _this$props7$cmsgNoti5,
          querySystemHistoryLoading = _this$props7.querySystemHistoryLoading,
          queryReceiverLoading = _this$props7.queryReceiverLoading,
          createReceiverLoading = _this$props7.createReceiverLoading,
          publishSystemNoticeLoading = _this$props7.publishSystemNoticeLoading,
          removeDraftReceiveLoading = _this$props7.removeDraftReceiveLoading,
          isTenantRole = _this$props7.isTenantRole,
          organizationId = _this$props7.organizationId;
      var actionNoticeId = this.state.actionNoticeId;
      var columns = [{
        title: intl.get('cmsg.notice.model.notice.receiverType').d('发布类别'),
        width: 100,
        dataIndex: 'receiverTypeMeaning'
      }, {
        title: intl.get('cmsg.notice.model.notice.title').d('公告标题'),
        dataIndex: 'title'
      }, {
        title: intl.get('cmsg.notice.model.notice.publishedByUser').d('发布人'),
        width: 150,
        dataIndex: 'publishedByUser'
      }, {
        title: intl.get('cmsg.notice.model.notice.statusCode').d('公告状态'),
        width: 100,
        dataIndex: 'statusMeaning'
      }, {
        title: intl.get('cmsg.notice.model.notice.publishedDate').d('发布时间'),
        width: 200,
        dataIndex: 'publishedDate',
        render: dateTimeRender
      }, {
        title: intl.get('cpaas.common.button.action').d('操作'),
        width: 150,
        fixed: 'right',
        render: function render(text, record) {
          var operators = [];
          operators.push({
            key: 'edit',
            ele: /*#__PURE__*/React.createElement(Link, {
              to: "/cmsg/notices/detail/".concat(record.noticeId)
            }, intl.get('cpaas.common.button.edit').d('编辑')),
            len: 2,
            title: intl.get('cpaas.common.button.edit').d('编辑')
          });

          if (record.statusCode === 'DELETED') {
            operators.push({
              key: 'revoke',
              ele: /*#__PURE__*/React.createElement(ButtonPermission, {
                type: "text",
                permissionList: [{
                  code: "".concat(path, ".button.revoke2"),
                  type: 'button',
                  meaning: '公告管理-撤销'
                }],
                onClick: function onClick() {
                  return _this5.handleRevokeNotice(record);
                }
              }, intl.get('cmsg.notice.button.revoke').d('撤销')),
              len: 2,
              title: intl.get('cmsg.notice.button.revoke').d('撤销')
            });
          } else if (publicLoading && record.noticeId === actionNoticeId) {
            operators.push({
              key: 'loading',
              ele: /*#__PURE__*/React.createElement(Icon, {
                type: "loading",
                style: {
                  marginLeft: 20
                }
              }),
              len: 2
            });
          } else {
            operators.push({
              key: 'release',
              ele: /*#__PURE__*/React.createElement(ButtonPermission, {
                type: "text",
                permissionList: [{
                  code: "".concat(path, ".button.release2"),
                  type: 'button',
                  meaning: '公告管理-发布'
                }],
                onClick: function onClick() {
                  return _this5.handlePublicNotice(record);
                }
              }, intl.get('cpaas.common.button.release').d('发布')),
              len: 2,
              title: intl.get('cpaas.common.button.release').d('发布')
            });
          }

          operators.push({
            key: 'delete',
            ele: /*#__PURE__*/React.createElement(Popconfirm, {
              title: intl.get('cpaas.common.message.confirm.delete').d('是否删除此条记录？'),
              onConfirm: function onConfirm() {
                _this5.handleDeleteNotice(record);
              }
            }, /*#__PURE__*/React.createElement(ButtonPermission, {
              type: "text",
              permissionList: [{
                code: "".concat(path, ".button.delete"),
                type: 'button',
                meaning: '公告管理-删除'
              }]
            }, intl.get('cpaas.common.button.delete').d('删除'))),
            len: 2,
            title: intl.get('cpaas.common.button.delete').d('删除')
          });
          return operatorRender(operators);
        }
      }];
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
        title: intl.get('cmsg.notice.view.message.title.list').d('公告管理')
      }, /*#__PURE__*/React.createElement(ButtonPermission, {
        permissionList: [{
          code: "".concat(path, ".button.create"),
          type: 'button',
          meaning: '公告管理-新建'
        }],
        icon: "plus",
        type: "primary",
        onClick: this.handleCreate
      }, intl.get('cpaas.common.button.create').d('新建'))), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement("div", {
        className: "table-list-search"
      }, this.renderFilterForm()), /*#__PURE__*/React.createElement(Table, {
        bordered: true,
        rowKey: "noticeId",
        loading: fetchNoticeLoading || publicLoading,
        dataSource: noticeList,
        columns: columns,
        scroll: {
          x: tableScrollWidth(columns)
        },
        pagination: pagination,
        onChange: this.handlePagination
      }), systemNoticePublishModalVisible && /*#__PURE__*/React.createElement(SystemNoticePublishDrawer, {
        visible: systemNoticePublishModalVisible,
        record: systemNoticePublishRecord,
        receiverRecordType: receiverRecordType,
        onOk: this.handleSystemNoticeModalOk,
        onCancel: this.handleSystemNoticeModalCancel,
        querySystemHistory: this.querySystemHistory,
        queryReceiver: this.queryReceiver,
        createReceiver: this.createReceiver,
        publishSystemNotice: this.publishSystemNotice,
        removeDraftReceive: this.removeDraftReceive,
        querySystemHistoryLoading: querySystemHistoryLoading,
        queryReceiverLoading: queryReceiverLoading,
        createReceiverLoading: createReceiverLoading,
        publishSystemNoticeLoading: publishSystemNoticeLoading,
        removeDraftReceiveLoading: removeDraftReceiveLoading,
        systemNoticeHistoryDataSource: systemNoticeHistoryDataSource,
        systemNoticeHistoryPagination: systemNoticeHistoryPagination,
        systemNoticeHistorySelectedRows: systemNoticeHistorySelectedRows,
        systemNoticeHistorySelectedRowKeys: systemNoticeHistorySelectedRowKeys,
        systemNoticeReceiveDataSource: systemNoticeReceiveDataSource,
        systemNoticeReceivePagination: systemNoticeReceivePagination,
        organizationId: organizationId,
        isTenantRole: isTenantRole
      })));
    }
  }]);

  return Notice;
}(React.PureComponent), (_applyDecoratedDescriptor(_class2.prototype, "handleCreate", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "handleCreate"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handlePagination", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "handlePagination"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleExpendSearch", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "handleExpendSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleResetSearch", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "handleResetSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSearch", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleNoticeTypeChange", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "handleNoticeTypeChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handlePublicNotice", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "handlePublicNotice"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleRevokeNotice", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "handleRevokeNotice"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleDeleteNotice", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "handleDeleteNotice"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "renderFilterForm", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "renderFilterForm"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSystemNoticeModalOk", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSystemNoticeModalOk"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSystemNoticeModalCancel", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSystemNoticeModalCancel"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "removeDraftReceive", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "removeDraftReceive"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "querySystemHistory", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "querySystemHistory"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "queryReceiver", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "queryReceiver"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "createReceiver", [_dec20], Object.getOwnPropertyDescriptor(_class2.prototype, "createReceiver"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "publishSystemNotice", [_dec21], Object.getOwnPropertyDescriptor(_class2.prototype, "publishSystemNotice"), _class2.prototype)), _class2)) || _class) || _class) || _class) || _class);
export { Notice as default };